[PATCH 6 of 8] MD: add sync_super to mddev_t struct

Add the 'sync_super' function pointer to MD array structure (struct mddev_s)

If device-mapper (dm-raid.c) is to define its own on-disk superblock and be
able to load it, there must still be a way for MD to initiate superblock
updates. The simplest way to make this happen is to provide a pointer in
the MD array structure that can be set by device-mapper (or other module)
with a function to do this. If the function has been set, it will be used;
otherwise, the method with be looked up via 'super_types' as usual.

Signed-off-by: Jonathan Brassow <jbrassow [at] redhat.com>

Index: linux-2.6/drivers/md/md.c
============================================================ =======
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
[at] [at] -1753,6 +1753,18 [at] [at] static struct super_type super_types[] =
},
};

+static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev)
+{
+ if (mddev->sync_super) {
+ mddev->sync_super(mddev, rdev);
+ return;
+ }
+
+ BUG_ON(mddev->major_version >= ARRAY_SIZE(super_types));
+
+ super_types[mddev->major_version].sync_super(mddev, rdev);
+}
+
static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
{
mdk_rdev_t *rdev, *rdev2;
[at] [at] -2171,8 +2183,7 [at] [at] static void sync_sbs(mddev_t * mddev, in
/* Don't update this superblock */
rdev->sb_loaded = 2;
} else {
- super_types[mddev->major_version].
- sync_super(mddev, rdev);
+ sync_super(mddev, rdev);
rdev->sb_loaded = 1;
}
}
Index: linux-2.6/drivers/md/md.h
============================================================ =======
--- linux-2.6.orig/drivers/md/md.h
+++ linux-2.6/drivers/md/md.h
[at] [at] -330,6 +330,7 [at] [at] struct mddev_s
atomic_t flush_pending;
struct work_struct flush_work;
struct work_struct event_work; /* used by dm to report failure event */
+ void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev);
};




--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jonathan Brassow [ Mi, 08 Juni 2011 00:51 ] [ ID #2060645 ]
Linux » gmane.linux.raid » [PATCH 6 of 8] MD: add sync_super to mddev_t struct

Vorheriges Thema: [PATCH 1/2] md/bitmap: use proper accessor macro
Nächstes Thema: [PATCH 5 of 8] MD: raid1 changes to allow use by device mapper